package com.example.wm.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.wm.common.Result;
import com.example.wm.common.ResultData;
import com.example.wm.entity.Custonmer;
import com.example.wm.entity.OfficialBusiness;
import com.example.wm.entity.OfficialBusinessDetial;
import com.example.wm.service.OfficialBusinessDetialService;
import com.example.wm.service.OfficialBusinessService;
import com.example.wm.utils.TsyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/OfficialBusinessDetailController")
@CrossOrigin
//出差明细
public class OfficialBusinessDetailController {
    @Resource
    private OfficialBusinessDetialService officialBusinessDetialService;
    @Resource
    private TsyUtils tsyUtils;
    @Resource
    private OfficialBusinessService officialBusinessService;
    @Transactional
    @PostMapping("/updatemsg")//打卡
    public Result updatemsg(@RequestBody OfficialBusinessDetial officialBusinessDetial ) {
        officialBusinessDetial.setDktime(tsyUtils.getnowtime());
//        LambdaQueryWrapper<OfficialBusiness> lq=new LambdaQueryWrapper<>();
//        lq.eq(OfficialBusiness::getId,officialBusinessDetial.getBusinessid());
//        OfficialBusiness of  =  officialBusinessService.getOne(lq);
//        of.setId(officialBusinessDetial.getBusinessid());
//       of.setFinishnum( of.getFinishnum()+1);
//       officialBusinessService.updateById(of);
        Boolean b= officialBusinessDetialService.updateById(officialBusinessDetial);
        return ResultData.success(b);

    }

}
